<template>
  <router-link :to="link" class="tool-card">
    <div class="tool-header">
      <el-icon :size="32"><component :is="icon" /></el-icon>
      <span class="tool-tag" v-if="isPro"><el-tag size="small" type="warning">PRO</el-tag></span>
    </div>
    <div class="tool-body">
      <h3 class="tool-title">{{ title }}</h3>
      <p class="tool-description">{{ description }}</p>
    </div>
    <div class="tool-footer">
      <el-button size="small" :type="isPro ? 'warning' : 'primary'">
        {{ buttonText || '立即使用' }}
      </el-button>
    </div>
  </router-link>
</template>

<script setup>
/**
 * 工具卡片组件
 * 用于展示工具并标识是否需要会员
 * 
 * @property {String} title - 工具标题
 * @property {String} description - 工具描述
 * @property {String} icon - 工具图标名称
 * @property {String} link - 工具链接
 * @property {Boolean} isPro - 是否为会员工具
 * @property {String} buttonText - 按钮文本
 */
defineProps({
  title: {
    type: String,
    required: true
  },
  description: {
    type: String,
    required: true
  },
  icon: {
    type: String,
    required: true
  },
  link: {
    type: String,
    required: true
  },
  isPro: {
    type: Boolean,
    default: false
  },
  buttonText: {
    type: String,
    default: ''
  }
});
</script>

<style scoped>
.tool-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.tool-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 20px 10px 20px;
  color: var(--primary-color);
}

.tool-body {
  padding: 0 20px 20px;
  flex-grow: 1;
}

.tool-title {
  font-size: 18px;
  margin: 0 0 10px 0;
  color: var(--primary-dark);
}

.tool-description {
  font-size: 14px;
  color: var(--dark-gray);
  margin: 0;
  line-height: 1.5;
}

.tool-footer {
  padding: 15px 20px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: center;
}
</style> 